package com.moetube.video.feign;

import com.moetube.entity.Result;
import com.moetube.video.pojo.Barrage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "video")
@RequestMapping("/barrage")
public interface BarrageFeign {
    /**
     * 查询全部数据
     *
     * @return
     */
    @GetMapping
    public Result findAll();
    /***
     * 根据ID查询数据
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Result<Barrage> findById(@PathVariable("id") Long id);
    /***
     * 新增数据
     * @param barrage
     * @return
     */
    @PostMapping
    public Result add(@RequestBody Barrage barrage);
    /***
     * 修改数据
     * @param barrage
     * @param id
     * @return
     */
    @PutMapping(value = "/{id}")
    public Result update(@RequestBody Barrage barrage, @PathVariable("id") Long id);

    /***
     * 根据ID删除品牌数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/{id}")
    public Result delete(@PathVariable("id") Long id);

    /***
     * 多条件搜索品牌数据
     * @param searchMap
     * @return
     */
    @GetMapping(value = "/search" )
    public Result findList(@RequestParam Map searchMap);

    /***
     * 分页搜索实现
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "/search/{page}/{size}" )
    public Result findPage(@RequestParam Map searchMap, @PathVariable("page")  int page, @PathVariable("size")  int size);

    @GetMapping("/video/{videoId}")
    public Result<List<Barrage>> findListByVideoId(@PathVariable("videoId") String videoId);
}
